package vn.edu.saigontech.ncms.service.impl;

import java.util.Collection;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;

import vn.edu.saigontech.ncms.model.system.ReceiptAmountDiscountItem;
import vn.edu.saigontech.ncms.service.ReceiptAmountDiscountItemService;

@SuppressWarnings("unchecked")
public class ReceiptAmountDiscountItemServiceImpl extends HibernateGenericService<ReceiptAmountDiscountItem, Long> implements ReceiptAmountDiscountItemService {

	@Override
	public Collection<ReceiptAmountDiscountItem> findAll() {
		Criteria criteria = this.createCriteria();
		criteria.addOrder(Order.asc("id"));
		return criteria.list();
	}
	
	@Override
	public List<ReceiptAmountDiscountItem> findAllAreActive() {
		Criteria criteria = this.createCriteria();
		criteria.add(Restrictions.eq("active", Boolean.TRUE));
		criteria.addOrder(Order.asc("id"));
		return criteria.list();
	}
}